import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LotcarorderVO, LotcarorderForm, LotcarorderQuery } from '@/api/access/parking-lot/parking-lot-car-order/types';

/**
 * 查询停车场-购买记录列表
 * @param query
 * @returns {*}
 */

export const listLotcarorder = (query?: LotcarorderQuery): AxiosPromise<LotcarorderVO[]> => {
  return request({
    url: '/parkinglot/lotCarOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停车场-购买记录详细
 * @param parkingLotOrderId
 */
export const getLotcarorder = (parkingLotOrderId: string | number): AxiosPromise<LotcarorderVO> => {
  return request({
    url: '/parkinglot/lotCarOrder/' + parkingLotOrderId,
    method: 'get'
  });
};

/**
 * 新增停车场-购买记录
 * @param data
 */
export const addLotcarorder = (data: LotcarorderForm) => {
  return request({
    url: '/parkinglot/lotCarOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改停车场-购买记录
 * @param data
 */
export const updateLotcarorder = (data: LotcarorderForm) => {
  return request({
    url: '/parkinglot/lotCarOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除停车场-购买记录
 * @param parkingLotOrderId
 */
export const delLotcarorder = (parkingLotOrderId: string | number | Array<string | number>) => {
  return request({
    url: '/parkinglot/lotCarOrder/' + parkingLotOrderId,
    method: 'delete'
  });
};
